#include "map.h"

Map::Map()
{
    //加载地图
    map1.load(":/res/back2.jpg");
    map2.load(":/res/back6.jpg");
    map3.load(":/res/back7.jpg");

    //初始化坐标
    m1_x=-700;
    m2_x=0;
    m3_x=700;

    //滚动速度
    m_scroll_speed=1;

}

Map::Map(int a)
{

    map1.load(":/res/back4.jpg");
    map2.load(":/res/back4.jpg");

    m_scroll_speed=1;

    m1_x=0;
    m2_x=600;
    m3_x=a;

}

void Map::mapPosition()
{
    //处理位置
    m1_x-=m_scroll_speed;
    if(m1_x<=-700){
        m1_x=1400-m_scroll_speed;
    }
    m2_x-=m_scroll_speed;
    if(m2_x<=-700){
        m2_x=1400-m_scroll_speed;
    }
    m3_x-=m_scroll_speed;
    if(m3_x<=-700){
        m3_x=1400-m_scroll_speed;
    }

}

void Map::map_for2()
{
    //处理位置
    m1_x+=m_scroll_speed;
    if(m1_x>=600){
        m1_x=-600+m_scroll_speed;
    }
    m2_x+=m_scroll_speed;
    if(m2_x>=600){
        m2_x=-600+m_scroll_speed;
    }

}
